import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ListPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _StatefulWidgetState();
  }
}

class _StatefulWidgetState extends State<StatefulWidget> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("列表页"),
        leading: BackButton(),
      ),
      body: Container(
        child: ListView.builder(
          itemBuilder: (context, pos) {
            return Card(
              elevation: 5,
              child: GestureDetector(
                onTap: () {
                  Scaffold.of(context).showSnackBar(SnackBar(
                    content: Text("我是item $pos"),
                    action: SnackBarAction(
                      label: "清除",
                      onPressed: () {},
                    ),
                  ));
                },
                child: Container(
                  alignment: Alignment.center,
                  width: double.infinity,
                  height: 60,
                  color: Color(0x123456 * pos * 100),
                  child: Text("item$pos"),
                ),
              ),
            );
          },
          itemCount: 1000,
        ),
      ),
    );
  }
}
